package com.ddwanglife.juc;

import java.util.concurrent.CountDownLatch;


public class CountDownLatchDemo {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch = new CountDownLatch(10);
        for (int i = 0;i<10;i++){
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"  关门走人");
                countDownLatch.countDown();
                },String.valueOf(i)).start();
        }
        countDownLatch.await();
        System.out.println("主线程结束");
    }
}
